 KindEditor.ready(function(K) {
                window.editor_content = K.create('#content', {
                uploadJson : 'index.php?m=manage&c=UpFile&a=up_ajax',
                fileManagerJson : 'index.php?m=manage&c=UpFile&a=manager_ajax',
                allowFileManager : true
        });
        });
		KindEditor.ready(function(K) {
		        window.editor_econtent = K.create('#econtent', {
                uploadJson : 'index.php?m=manage&c=UpFile&a=up_ajax',
                fileManagerJson : 'index.php?m=manage&c=UpFile&a=manager_ajax',
                allowFileManager : true
        });
		});
		
		
	$(document).ready(function(){ 	
	$('.ke-icon-imgdown').click(function(){
	  var img = $('.ke-edit-iframe').contents().find('img');
	  $(img).each(function (i) {
	     var that = $(this);
		 console.log(that[0].currentSrc);
	     if (that.attr('src').indexOf('http://') >= 0 || that.attr('src').indexOf('https://') >= 0) {
	      $.ajax({
	         url: 'index.php?m=manage&c=UpFile&a=up_ajax_url&dir=image',
	         data: 'imgUrl=' + encodeURIComponent(that[0].currentSrc),//that.attr('src').split('?')[0],
	         type: 'POST',
	         dataType: 'json', 
	         async: false,
	         success: function (data) {
			 if(data.error==0){
	          that.attr('src',data.url);
	          that.attr('data-ke-src',data.url);
			  
			  }else{
				  layui.layer.msg(that[0].currentSrc+'本地化失败');
			  }
	         }
	     });
	     }
	  });
	  
	  layui.layer.alert('本地化完成');
	  window.editor_content.sync(); 
	  window.editor_econtent.sync();
	
	});	
	
	});